<?php
namespace Admin\Controller;

// 本类由系统自动生成，仅供测试用途
class IndexController extends PublicController {
	function _initialize() {
		parent::_initialize ();
	}

	public function index() {
        if (! session("userInfo")) {
            $this->error ( "登录失败", U ( "Admin/Login/index" ) );
        }else{
            $this->assign("userInfo",session("userInfo"));
            $this->display ();
        }
	}

	public function set() {
		if (session("userInfo")) {
			$result = R ( "Api/Api/getsetting" );
			$this->assign ( "info", $result );
			
			$themedir = getDir("./Theme/");
			
			for ($i = 0; $i < count($themedir); $i++) {
				$theme[$i] = simplexml_load_file("./Theme/".$themedir[$i]."/config.xml");
				if (isset($theme[$i])) {
					$theme[$i]->dir = $themedir[$i];
				}
			}

			$this->assign("theme",$theme);
			$this->assign("settheme",$result["theme"]);
			$payresult = R ( "Api/Api/getalipay" );
			$this->assign ( "alipay", $payresult );
			$this->display ();
		}
	}

    public function Welcome(){
        if (! session("userInfo")) {
            $this->error ( "登录失败", U ( "Admin/Login/index" ) );
        }else{
            $this->assign("name",session("userInfo"));
            $this->display ();
        }
    }

}